﻿/*****************************************************************//**
 * @file   VAOneXMLAdaptorSeaFacesSingleCurve.h
 * @brief  VAOne读写FACES适配器
 * 
 * @author lixiaolong
 * @date   2024-10-30
 *********************************************************************/
#ifndef VAONEXMLADAPTORSEAFACESSINGLECURVE_H
#define VAONEXMLADAPTORSEAFACESSINGLECURVE_H

#include "FITKVAOneXMLIOAPI.h"
#include "FITKAbstractVAOneXMLAdaptor.h"
#include "FITK_Kernel/FITKCore/FITKCoreMacros.h"
#include "FITK_Kernel/FITKAdaptor/FITKIOAdaptorFactory.h"
#include "FITKAcousticsModel/FITKAbstractSEASubSysWithNodes.h"
#include "VAOneXMLAdaptorSeaFaces.h"

namespace Acoustics
{
    class FITKSEAFaceManager;
    class FITKAbstractSEAFace;
}

namespace IO
{
    /**
     * @brief   VAOne读写FACE适配器
     * @author  lixiaolong
     * @date    2024-11-7
     */
    class FITKVAOneXMLIOAPI VAOneXMLAdaptorSeaFacesSingleCurve : public VAOneXMLAdaptorSeaFaces
    {
        FITKCLASS(IO, VAOneXMLAdaptorSeaFacesSingleCurve);
    public:

        /**
         * @brief   构造函数
         * @author  lixiaolong
         * @date    2024-11-7
         */
        explicit VAOneXMLAdaptorSeaFacesSingleCurve()= default;

        /**
         * @brief   析构函数
         * @author  lixiaolong
         * @date    2024-11-7
         */
        ~VAOneXMLAdaptorSeaFacesSingleCurve() = default;

    protected:

        /**
         * @brief getNodeName 获取xml节点名字
         * @return  xml节点名字 类型无效时需子类自己实现adaptR和adaptW 有效时根据实际数据重新实现读写接口
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        virtual QString getNodeName() override;

        /**
         * @brief getNodeType 获取节点类型
         * @return  节点类型 类型无效时需子类自己实现adaptR和adaptW 有效时根据实际数据重新实现读写接口
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        virtual Acoustics::FITKAbstractSEASubSys::SEASubSysType getNodeType() override;

        /**
         * @brief createDataObjNode 创建数据节点
         * @return 数据节点实例
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        virtual Acoustics::FITKAbstractSEAFace *createDataObjNode() override;

        /**
         * @brief readCell  读取单个face数据
         * @param node[i]      xml节点
         * @param data[o]      节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void readCell(rapidxml::xml_node<char> *node, Acoustics::FITKAbstractSEAFace *data) override;

        /**
         * @brief writeCell  写入单个face数据
         * @param data[i]      节点数据
         * @param node[o]      xml节点
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        virtual void writeCell(Acoustics::FITKAbstractSEAFace *data, rapidxml::xml_node<char> *node) override;

    private:
        /**
         * @brief readCornerList 获取corner列表
         * @param[i] node       xml节点
         * @param[o] data       数据节点
         * @return   corner列表
         * @author  lixiaolong
         * @date    2024-11-8
         */
        QList<int> readCornerList(rapidxml::xml_node<char>* node, Acoustics::FITKAbstractSEAFace *data);

        /**
         * @brief getCornerList 获取corner列表
         * @param[i] data       数据节点
         * @param[o] node       xml节点
         * @return   corner列表
         * @author  lixiaolong
         * @date    2024-11-8
         */
        void writeCornerList(Acoustics::FITKAbstractSEAFace *data, rapidxml::xml_node<char>* node);
    };

    Register2FITKIOAdaptorFactory(VAOneXMLFaceSingleCurve, Acoustics::FITKSEAFaceManager, VAOneXMLAdaptorSeaFacesSingleCurve)
}

#endif // VAONEXMLADAPTORSEAFACESSINGLECURVE_H
